home *** CD-ROM | disk | FTP | other *** search
/ Personal Computer World 2005 October / PCWOCT05.iso / Software / FromTheMag / The GIMP 2.2.8 / gimp-2.2.8-i586-setup.exe / {app} / share / gimp / 2.0 / scripts / gimp-headers.scm < prev    next >
Encoding:
GIMP Script-Fu Script  |  2005-06-30  |  6.8 KB  |  178 lines

  1. ; The GIMP -- an image manipulation program
  2. ; Copyright (C) 1995 Spencer Kimball and Peter Mattis
  3. ; www.gimp.org web headers
  4. ; Copyright (c) 1997 Adrian Likins
  5. ; aklikins@eos.ncsu.edu
  6. ;
  7. ; based on a idea by jtl (Jens  Lautenbacher)
  8. ; and improved by jtl
  9. ;
  10. ; This program is free software; you can redistribute it and/or modify
  11. ; it under the terms of the GNU General Public License as published by
  12. ; the Free Software Foundation; either version 2 of the License, or
  13. ; (at your option) any later version.
  14. ; This program is distributed in the hope that it will be useful,
  15. ; but WITHOUT ANY WARRANTY; without even the implied warranty of
  16. ; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  17. ; GNU General Public License for more details.
  18. ; You should have received a copy of the GNU General Public License
  19. ; along with this program; if not, write to the Free Software
  20. ; Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  21. ;
  22. ;  **NOTE**  This fonts use some very common fonts, that are typically
  23. ;  bitmap fonts on most installations. If you want better quality versions
  24. ;  you need to grab the urw font package form www.gimp.org/fonts.html
  25. ;  and install as indicated. This will replace the some current bitmap fonts
  26. ;  with higher quality vector fonts. This is how the actual www.gimp.org
  27. ;  logos were created.
  28. ;
  29. ; ************************************************************************
  30. ; Changed on Feb 4, 1999 by Piet van Oostrum <piet@cs.uu.nl>
  31. ; For use with GIMP 1.1.
  32. ; All calls to gimp-text-* have been converted to use the *-fontname form.
  33. ; The corresponding parameters have been replaced by an SF-FONT parameter.
  34. ; ************************************************************************
  35.  
  36. (define (script-fu-headers-gimp-org text font font-size text-color high-color side-color shadow-color crop rm-bg index num-colors)
  37.   (let* ((img (car (gimp-image-new 256 256 RGB)))
  38.      (text-layer (car (gimp-text-fontname img -1 0 0
  39.                      text 30 TRUE font-size PIXELS
  40.                      font)))
  41.      (width (car (gimp-drawable-width text-layer)))
  42.      (height (car (gimp-drawable-height text-layer)))
  43.      (bg-layer (car (gimp-layer-new img width height RGB-IMAGE "Background" 100 NORMAL-MODE))))
  44.  
  45.     (gimp-context-push)
  46.  
  47.     (gimp-image-undo-disable img)
  48.     (gimp-image-resize img width height 0 0)
  49.     (gimp-image-add-layer img bg-layer 1)
  50.     (gimp-layer-set-preserve-trans text-layer TRUE)
  51.     (gimp-context-set-background text-color)
  52.     (gimp-edit-fill text-layer BACKGROUND-FILL)
  53.  
  54.     (gimp-context-set-background '(255 255 255))
  55.     (gimp-edit-fill bg-layer BACKGROUND-FILL)
  56.  
  57.     (let* ((highlight-layer (car (gimp-layer-copy text-layer TRUE)))
  58.        (side-layer (car (gimp-layer-copy text-layer TRUE)))
  59.        (shadow-layer (car (gimp-layer-copy text-layer TRUE))))
  60.  
  61.       (gimp-image-add-layer img highlight-layer 1)
  62.       (gimp-layer-set-preserve-trans highlight-layer TRUE)
  63.       
  64.       (gimp-image-add-layer img side-layer 1)
  65.       (gimp-layer-set-preserve-trans side-layer TRUE)
  66.       
  67.       (gimp-image-add-layer img shadow-layer 1)
  68.       (gimp-layer-set-preserve-trans shadow-layer TRUE)
  69.       
  70.       (gimp-context-set-background high-color)
  71.       (gimp-edit-fill highlight-layer BACKGROUND-FILL)
  72.       (gimp-layer-translate highlight-layer -1 -1)
  73.       
  74.       (gimp-context-set-background side-color)
  75.       (gimp-edit-fill side-layer BACKGROUND-FILL)
  76.       (gimp-layer-translate side-layer 1 1)
  77.  
  78.       (gimp-context-set-background shadow-color)
  79.       (gimp-edit-fill shadow-layer BACKGROUND-FILL)
  80.       (gimp-layer-translate shadow-layer 5 5)
  81.       
  82.       (gimp-layer-set-preserve-trans shadow-layer FALSE)
  83.       (plug-in-gauss-rle 1 img shadow-layer 5 TRUE TRUE)
  84.       (gimp-layer-set-opacity shadow-layer 60)
  85.       (gimp-image-lower-layer img shadow-layer)
  86.       (gimp-image-lower-layer img shadow-layer))
  87.   
  88.  
  89.     (set! text-layer (car (gimp-image-flatten img)))
  90.     (gimp-layer-add-alpha text-layer)
  91.       
  92.  
  93.     (if (= rm-bg TRUE)
  94.     (begin
  95.       (gimp-by-color-select text-layer '(255 255 255)
  96.                 1 CHANNEL-OP-REPLACE TRUE FALSE 0 FALSE)
  97.       (gimp-edit-clear text-layer)
  98.       (gimp-selection-none img)))
  99.         
  100.     (if (= crop TRUE)
  101.      (plug-in-autocrop 1 img text-layer))
  102.  
  103.     (if (= index TRUE)
  104.     (gimp-image-convert-indexed img FS-DITHER MAKE-PALETTE num-colors
  105.                     FALSE FALSE ""))
  106.     
  107.  
  108.     (gimp-image-undo-enable img)
  109.     (gimp-display-new img)
  110.  
  111.     (gimp-context-pop)))
  112.  
  113. (define (script-fu-big-header-gimp-org text font font-size text-color
  114.                     high-color side-color shadow-color
  115.                     crop rm-bg index num-colors)
  116.   (script-fu-headers-gimp-org (string-append " " text)
  117.                   font font-size
  118.                   text-color high-color side-color shadow-color
  119.                   crop rm-bg index num-colors))
  120.  
  121.  
  122. (define (script-fu-small-header-gimp-org text font font-size text-color
  123.                     high-color side-color shadow-color
  124.                     crop rm-bg index num-colors)
  125.   (script-fu-headers-gimp-org text font
  126.                   font-size text-color high-color
  127.                   side-color shadow-color
  128.                   crop rm-bg index num-colors))
  129.  
  130.  
  131. (script-fu-register "script-fu-big-header-gimp-org"
  132.             _"_Big Header..."
  133.             "Big Gimp.org Header"
  134.             "Adrian Likins & Jens Lautenbacher"
  135.             "Adrian Likins & Jens Lautenbacher"
  136.             "1997"
  137.             ""
  138.             SF-STRING     _"Text"               "gimp.org"
  139.             SF-FONT       _"Font"               "Serif"
  140.             SF-ADJUSTMENT _"Font size (pixels)" '(50 2 1000 1 10 0 1)
  141.             SF-COLOR      _"Text color"         '(82 108 159)
  142.             SF-COLOR      _"Highlight color"    '(190 220 250)
  143.             SF-COLOR      _"Dark color"         '(46 74 92)
  144.             SF-COLOR      _"Shadow color"       '(0 0 0)
  145.             SF-TOGGLE     _"Autocrop"           TRUE
  146.             SF-TOGGLE     _"Remove background"  TRUE
  147.             SF-TOGGLE     _"Index image"        TRUE
  148.             SF-ADJUSTMENT _"Number of colors"   '(15 2 255 1 10 0 1))
  149.  
  150. (script-fu-menu-register "script-fu-big-header-gimp-org"
  151.              _"<Toolbox>/Xtns/Script-Fu/Web Page Themes/Classic.Gimp.Org")
  152.  
  153. (script-fu-register "script-fu-small-header-gimp-org"
  154.             _"_Small Header..."
  155.             "Small Gimp.org Header"
  156.             "Adrian Likins & Jens Lautenbacher"
  157.             "Adrian Likins & Jens Lautenbacher"
  158.             "1997"
  159.             ""
  160.             SF-STRING     _"Text"               "gimp.org"
  161.             SF-FONT       _"Font"               "Sans"
  162.             SF-ADJUSTMENT _"Font size (pixels)" '(24 2 1000 1 10 0 1)
  163.             SF-COLOR      _"Text color"         '(135 220 220)
  164.             SF-COLOR      _"Highlight color"    '(210 240 245)
  165.             SF-COLOR      _"Dark color"         '(46 74 92)
  166.             SF-COLOR      _"Shadow color"       '(0 0 0)
  167.             SF-TOGGLE     _"Autocrop"           TRUE
  168.             SF-TOGGLE     _"Remove background"  TRUE
  169.             SF-TOGGLE     _"Index image"        TRUE
  170.             SF-ADJUSTMENT _"Number of colors"   '(15 2 255 1 10 0 1)
  171.             SF-ADJUSTMENT _"Select-by-color threshold" '(1 1 256 1 10 0 1))
  172.  
  173. (script-fu-menu-register "script-fu-small-header-gimp-org"
  174.              _"<Toolbox>/Xtns/Script-Fu/Web Page Themes/Classic.Gimp.Org")
  175.